package com.hushow.plugin.brick.service.impl;


import com.hushow.plugin.brick.service.PaymentPlugin;
import com.hushow.plugin.brick.service.PaymentPluginRegistryManager;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

@Service
public class PaymentService {

    @Resource
    private PaymentPluginRegistryManager paymentPluginRegistryManager;

    public String makePayment(Map<String, Object> orderInfo, String paymentMethod) {
        PaymentPlugin plugin = paymentPluginRegistryManager.getPlugin(paymentMethod);
        return plugin.pay(orderInfo);
    }
}
